import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, ManyToOne } from 'typeorm';
import { User } from './User';
import { Word } from './Word';

@Entity('study_records')
export class StudyRecord {
  @PrimaryGeneratedColumn()
  id: number;

  @ManyToOne(() => User, user => user.studyRecords)
  user: User;

  @ManyToOne(() => Word, word => word.studyRecords)
  word: Word;

  @Column()
  studyType: 'new' | 'review';

  @Column()
  studyResult: 'correct' | 'incorrect';

  @Column({ type: 'int' })
  studyDuration: number;

  @Column({ type: 'datetime' })
  studyTime: Date;

  @CreateDateColumn()
  createdAt: Date;

  @UpdateDateColumn()
  updatedAt: Date;
} 